import { defineStore } from 'pinia'
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'


export const useLocaleStore = defineStore('locale', () => {
  const { locale } = useI18n()
  const currentLocale = ref(locale.value)

  const changeLocale = (lang: string) => {
    locale.value = lang
    currentLocale.value = lang
  }

  return {
    currentLocale,
    changeLocale
  }
},{
  persist: true
})